package com.leet.code.simple_array;

/**
 * @description:    1486.数组异或操作
 * @author: WYG
 * @time: 2021/1/5 9:30
 */

public class XorOperation {

    public int xorOperation(int n, int start) {
        if (n == 1) return start;
        int res = (start) ^ (start + 2);
        for (int i = 2; i < n; i++) {
            res = res ^ (start + 2 * i);
        }
        return res;
    }

}
